using Avalonia.Platform;
using Making.Avalonia.WebView.Core.Models;

namespace Making.Avalonia.WebView.Core.Abstractions;

public interface IWebViewProvider
{
    IPlatformHandle CreateWebView(IPlatformHandle parent, WebViewConfiguration configuration);
    void DestroyWebView(IPlatformHandle webView);
    
    Task NavigateAsync(IPlatformHandle webView, Uri uri);
    Task<string> ExecuteScriptAsync(IPlatformHandle webView, string script);
    
    void SetZoomFactor(IPlatformHandle webView, double zoomFactor);
    double GetZoomFactor(IPlatformHandle webView);
    
    bool CanGoBack(IPlatformHandle webView);
    bool CanGoForward(IPlatformHandle webView);
    void GoBack(IPlatformHandle webView);
    void GoForward(IPlatformHandle webView);
    void Reload(IPlatformHandle webView);
    
    void AddWebResourceFilter(IPlatformHandle webView, string filter);
    
    event EventHandler<WebResourceRequestedEventArgs>? WebResourceRequested;
    event EventHandler<NavigationEventArgs>? NavigationStarting;
    event EventHandler<NavigationEventArgs>? NavigationCompleted;
}